package org.dean.webapps.projectname.presentation.utils;

import org.apache.commons.lang.StringUtils;

/**
 * Created by IntelliJ IDEA.
 * User: dean
 * Date: 8/24/11
 * Time: 2:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class AddressUtils {
    public static String mergeAddress(String address1, String address2, String city, String state, String country) {
        String wholeAddress = "";

        if (!StringUtils.isEmpty(address1)) {
            wholeAddress += address1 + " ";
        }

        if (!StringUtils.isEmpty(address2)) {
            wholeAddress += address2 + " ";
        }

        if (!StringUtils.isEmpty(city)) {
            wholeAddress += city + " ";
        }

        if (!StringUtils.isEmpty(state)) {
            wholeAddress += state + " ";
        }

        if (!StringUtils.isEmpty(country)) {
            wholeAddress += country + " ";
        }

        return wholeAddress;
    }
}
